﻿package mortal.game.view.tianDiRank.item
{
    import com.gengine.utils.*;
    import com.mui.controls.*;
    import extend.language.*;
    import mortal.common.global.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.tianDiRank.data.*;

    public class TianDiRankPosDeCell extends GSprite
    {
        protected var _bg:GImageBitmap;
        protected var _noDes:GTextFiled;
        protected var _noTxt:GTextFiled;
        protected var _posDes:GTextFiled;
        protected var _posName:GTextFiled;
        protected var _attDes:GTextFiled;
        protected var _attList:CellsGridSprite;

        public function TianDiRankPosDeCell()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.gImageBitmap(ImagesConst.TianDiRankPosAttBlueBg, 0, 0, this);
            this._noDes = UIFactory.gTextField("", 21, 6, 100, 25, this, GlobalStyle.textFormatHuang2.setSize(15).setBold(true));
            this._noTxt = UIFactory.gTextField("", 84, 7, 180, 25, this, GlobalStyle.textFormatPutong.setSize(15).setBold(true));
            this._posDes = UIFactory.gTextField("" + Language.getString(71945), 21, 27, 100, 25, this, GlobalStyle.textFormatHuang2.setSize(15).setBold(true));
            this._posName = UIFactory.gTextField("", 83, 28, 180, 25, this, GlobalStyle.textFormatPutong.setSize(15).setBold(true));
            this._attDes = UIFactory.gTextField("" + Language.getString(71946), 21, 49, 100, 20, this, GlobalStyle.textFormatHuang2.setSize(15).setBold(true));
            this._attList = UIFactory.getUICompoment(CellsGridSprite);
            this._attList.colNum = 2;
            this._attList.vCellWid = 90;
            this._attList.hCellWid = 20;
            this._attList.genCellFun = UIFactory.getUICompoment;
            this._attList.genCells(5, TianDiAttCell2);
            this._attList.x = 81;
            this._attList.y = 50;
            this.addChild(this._attList);
            this._noDes.mouseEnabled = false;
            this._noTxt.mouseEnabled = false;
            this._posDes.mouseEnabled = false;
            this._posName.mouseEnabled = false;
            this._attDes.mouseEnabled = false;
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._bg = null;
            this._noDes = null;
            this._noTxt = null;
            this._posDes = null;
            this._posName = null;
            this._attDes = null;
            this._attList = null;
            return;
        }// end function

        public function updateCells(param1:Boolean, param2:Object, param3:int) : void
        {
            var _loc_7:TianDiAttCell2 = null;
            var _loc_8:Object = null;
            if (this._bg)
            {
                this._bg.dispose();
            }
            if (param1)
            {
                this._bg = UIFactory.gImageBitmap(ImagesConst.TianDiRankPosAttBlueBg, 0, 0, this);
            }
            else
            {
                this._bg = UIFactory.gImageBitmap(ImagesConst.TianDiRankPosAttRedBg, 0, 0, this);
            }
            this.addChildAt(this._bg, 0);
            var _loc_4:* = TianDiRankUtil.getPosNum(param3);
            this._noDes.text = Language.getStringByParam(71947, GameDefConfig.instance.getChineseNum(_loc_4));
            if (param2.nameStr == "" || param2.nameStr == null)
            {
                this._noTxt.htmlText = HTMLUtil.addColor("" + Language.getString(71940), "#ff0000");
            }
            else
            {
                this._noTxt.text = "" + param2.nameStr;
            }
            this._posName.text = "" + param2.posName;
            var _loc_5:* = param2.attArr;
            this._attList.genCells(_loc_5.length, TianDiAttCell2);
            var _loc_6:int = 0;
            while (_loc_6 < _loc_5.length)
            {
                
                _loc_7 = this._attList.cellArr[_loc_6];
                _loc_8 = _loc_5[_loc_6];
                _loc_7.updateInfo(_loc_8["attrName"], _loc_8["attrValue"]);
                _loc_6++;
            }
            return;
        }// end function

    }
}
